using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace RiceShop.Models
{
    /// <summary>
    /// 购物车实体类
    /// </summary>
    [Table("Cart")]
    public class Cart
    {
        /// <summary>
        /// 购物车ID
        /// </summary>
        [Key]
        [Column("id")]
        public long Id { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        [Column("userId")]
        public long UserId { get; set; }

        /// <summary>
        /// 商品SPU ID
        /// </summary>
        [Column("spuId")]
        public long SpuId { get; set; }

        /// <summary>
        /// 商品标题
        /// </summary>
        [Column("goodTitle")]
        [StringLength(255)]
        public string? GoodTitle { get; set; }

        /// <summary>
        /// 商品单价
        /// </summary>
        [Column("salePrice", TypeName = "decimal(18,2)")]
        public decimal SalePrice { get; set; }

        /// <summary>
        /// 商品数量
        /// </summary>
        [Column("quantity")]
        public int Quantity { get; set; }

        /// <summary>
        /// 是否选中
        /// </summary>
        [Column("isSelected")]
        public bool IsSelected { get; set; }

        /// <summary>
        /// SKU ID
        /// </summary>
        [Column("skuId")]
        public long SkuId { get; set; }


        /// <summary>
        /// 库存数量
        /// </summary>
        [Column("stockQuantity")]
        public int StockQuantity { get; set; }



        /// <summary>
        /// 规格值组合
        /// </summary>
        [Column("specValues")]
        public string? SpecValues { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("createTime")]
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Column("updateTime")]
        public DateTime? UpdateTime { get; set; }




        /// <summary>
        /// 商品信息
        /// </summary>
        [Required]
        [ForeignKey("SpuId")]
        public Good Good { get; set; } = null!;

        /// <summary>
        /// SKU信息
        /// </summary>
        [Required]
        [ForeignKey("SkuId")]
        public SKU SKU { get; set; } = null!;

        /// <summary>
        /// 商品编码
        /// </summary>
        [Column("code")]
        [StringLength(50)]
        public string? Code { get; set; }

        /// <summary>
        /// 商品单位
        /// </summary>
        [Column("unit")]
        [StringLength(20)]
        public string? Unit { get; set; }

        /// <summary>
        /// 划线价
        /// </summary>
        [Column("linePrice", TypeName = "decimal(18,2)")]
        public decimal? LinePrice { get; set; }

    }
}